<template>
<div>
<el-dialog title="商品编辑" :visible.sync="dialogFormVisible" width="35%" :before-close='close'>
  <el-form>
    <el-form-item label="商品名称">
      <el-input v-model="editGoodInfo.name"></el-input>
    </el-form-item>
    <el-form-item label="所属分类">
      <el-select v-model="editGoodInfo.category" placeholder="请选择所属分类">
        <el-option label="(冒菜)套餐自选区" value="(冒菜)套餐自选区"></el-option>
        <el-option label="撸烤串" value="撸烤串"></el-option>
        <el-option label="满减专区" value="满减专区"></el-option>
        <el-option label="营养适配" value="营养适配"></el-option>
        <el-option label="千万销量" value="千万销量"></el-option>
        <el-option label="炒饭系列" value="炒饭系列"></el-option>
        <el-option label="热销榜" value="热销榜"></el-option>
        <el-option label="新品专享" value="新品专享"></el-option>
        <el-option label="鲜炒盖饭" value="鲜炒盖饭"></el-option>
        <el-option label="收藏门店超值专享" value="收藏门店超值专享"></el-option>
        <el-option label="新品专享" value="新品专享"></el-option>
      </el-select>	
    </el-form-item>
    <el-form-item label="商品价格">
      <template>
        <el-input-number v-model="editGoodInfo.price" :min="1" :max="99"></el-input-number>
      </template>
    </el-form-item>
    <el-form-item label="商品图片">
      <imgUpload v-model="editGoodInfo.imgUrl"/>
    </el-form-item>
    <el-form-item label="商品描述">
      <el-input v-model="editGoodInfo.goodsDesc"></el-input>
    </el-form-item>
  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="update_dialogVisible(false)">取 消</el-button>
    <el-button type="primary" @click="confirm">确 定</el-button>
  </div>
</el-dialog>
</div>
</template>



<script>
import { mapState, mapMutations, mapActions } from "vuex";
import imgUpload from "./ImgUpload";
export default {
  components: {
    imgUpload
  },
  data() {
    return {};
  },
  computed: {
    ...mapState("goods", ["dialogFormVisible", "editGoodInfo"])
  },
  methods: {
    ...mapMutations("goods", ["update_dialogVisible"]),
    ...mapActions("goods", ["sync_edit_good", "sync_update_goodsList"]),
    close() {
      this.update_dialogVisible(false);
    },
    confirm() {
      this.sync_edit_good();
    }
  }
};
</script>
<style scoped>
.el-input--small {
  width: 400px;
}
</style>